package com.bdqn.t382.practice2;

import lombok.Data;

import java.util.Random;

@Data
public class Printer {
    public void print(String content) {
        Random random = new Random();

        int result = random.nextInt(10); // 生成 0-9 的随机数

        if (result < 5) {
            System.out.println("正在打印内容: " + content);
        } else if (result >= 5 && result <= 7) {
            throw new RuntimeException("打印机卡纸异常！");
        } else {
            throw new RuntimeException("墨盒无墨异常！");
        }
    }
}
